home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 32 / jots.zip / KNWNLIST.BAS < prev    next >
BASIC Source File  |  1989-03-13  |  2KB  |  74 lines

  1. ' KNWNLIST.BAS -- This module keeps track of the list of letters that the
  2. ' user knows are in the secret word, and lets the user modify the list
  3. ' $INCLUDE: 'J.INC'
  4.  
  5. DIM SHARED MyBox AS BoxType, TopRow, BotRow, LftCol, RtCol
  6. DIM SHARED KnownLetters AS STRING * 5, KnownCount
  7.  
  8. SUB InitKnownList
  9.     CALL BoxCoords(KnownBox, MyBox)
  10.     TopRow = MyBox.TopRow
  11.     BotRow = MyBox.BotRow
  12.     LftCol = MyBox.LftCol
  13.     RtCol = MyBox.RtCol
  14.     KnownLetters$ = " "
  15.     KnownCount = 0
  16.     NormalBox (KnownBox)
  17.     COLOR Normal, Background, Background
  18.     LOCATE TopRow + 1, LftCol + 2, 0
  19.     PRINT "Known Letters";
  20.     COLOR Dark, Background, Background
  21.     LOCATE TopRow + 3, LftCol + 6, 0
  22.     PRINT "-----";
  23. END SUB
  24.  
  25. SUB ChangeKnownList
  26.     ShowMessage ("Enter letter, Backspace to erase, <TAB> for next box, <Return> to end")
  27.     HighlightBox (KnownBox)
  28.     Row = TopRow + 3
  29.     Col = LftCol + 6
  30.     DO
  31.         COLOR Dark, Background, Background
  32.         LOCATE Row, Col + KnownCount, 1, 0, 7
  33.         DO
  34.             Char$ = INKEY$
  35.         LOOP UNTIL LEN(Char$)
  36.         IF Char$ = CHR$(13) THEN                        'Carriage return
  37.             COLOR Normal, Background, Background
  38.             NormalBox (KnownBox)
  39.             EXIT SUB
  40.         ELSEIF Char$ = CHR$(9) THEN                     'TAB
  41.             COLOR Normal, Background, Background
  42.             NormalBox (KnownBox)
  43.             ChangePossList
  44.             EXIT SUB
  45.         ELSE                                            'Changes in this box
  46.             IF Char$ = CHR$(8) AND KnownCount > 0 THEN   '  Backspace
  47.                 MID$(KnownLetters$, KnownCount, 1) = " "
  48.                 KnownCount = KnownCount - 1
  49.                 LOCATE Row, Col + KnownCount, 0
  50.                 PRINT "-";
  51.                 LOCATE Row, Col + KnownCount, 1, 0, 7
  52.                 COLOR Normal, Background, Background
  53.                 RedrawGuessList
  54.                 RedrawPossList
  55.             END IF
  56.             Char$ = UCASE$(Char$)                        '  Other characters
  57.             IF Char$ >= "A" AND Char$ <= "Z" AND KnownCount < 5 THEN
  58.                 COLOR Known, Background, Background
  59.                 PRINT Char$;
  60.                 KnownCount = KnownCount + 1
  61.                 MID$(KnownLetters$, KnownCount, 1) = Char$
  62.                 COLOR Normal, Background, Background
  63.                 RedrawGuessList
  64.                 RedrawPossList
  65.             END IF
  66.         END IF
  67.     LOOP
  68. END SUB
  69.  
  70. FUNCTION KnownList$
  71.     KnownList$ = KnownLetters$
  72. END FUNCTION
  73.  
  74.